const selectTrim = {
  bind(el, { value }, vNode) {
    const componentInstance = vNode.componentInstance
    if(!(componentInstance && componentInstance.filterable)){
      return;
    }
    // 获取组件实例，获取查询参数，修改查询参数
    el.__zbb_handler__ = (e) => {
      // 此处可以用来做其他格式限制，获取组件实例修改其内容
      componentInstance.query = componentInstance.query.trim()
    };
    el.addEventListener('input', el.__zbb_handler__);
  },
  unbind(el) {
    if (typeof el.__zbb_handler__ === 'function') {
      el.removeEventListener('input', el.__zbb_handler__);
      delete el.__zbb_handler__;
    }
  }
}
const install = function (Vue) {
  Vue.directive("selectTrim", selectTrim);
};

selectTrim.install = install;
export default selectTrim;
